<?php

class Empeval_AuthData_ADAuto implements Empeval_AuthData_ILoginData {
	
	private $login;
	private $domain;
	
	public function __construct($login, $domain) {
		$this->login = $login;
		$this->domain = $domain;
	}
	
	public function getUser() {
		return EmpevalUsersQuery::create()
			->withRoles()
			->withPosition()
			->filterByAd($this->login)
			->filterByActive(true)
			->filterByDeleted(null, Criteria::ISNULL)
			->find()
			->getFirst();
	}
	
	public function getId() {
		return $this->login;
	}
}